<?php

/*
* Update the contents of a user story.
*
* @header id The id of the note
* @header project The name of the project the note belongs to
* @header text The content of the note
* @header color The color of the note. One of green,blue,yellow
* @header name The title of the note
*
* @return mysql_error()
*          if there was an error updating the database
* @return "success"
*          upon success
*/

require_once("session.php");
require_once("connect_to_database.php");

$project = $_POST['project'];
$id = $_POST['id'];
$text = $_POST['text'];
$color = $_POST['color'];
$name = $_POST['name'];

$query = sprintf("update %s set text='%s',name='%s',color='%s' where id=%s ",
                 $project,$text,$name,$color,$id);
$result = mysql_query($query);

if(!$result){
				error_log($query.mysql_error());
				die(mysql_error());
}

echo("success");
?>
